package org.socialresume.client.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

public class FeedItem implements Serializable,Comparable<FeedItem>{

	private static final long serialVersionUID = -6708075224090846123L;

	private String id;

	private Date date;
	private String content;
	private Map<String,String> infos;
	
	public FeedItem(){}
	
	public FeedItem(String id, Date date, String content){
		this.id = id;
		this.date = date;
		this.content = content;
	}
	
	public Map<String, String> getInfos() {
		return infos;
	}

	public void setInfos(Map<String, String> infos) {
		this.infos = infos;
	}

	public Date getDate() {
		return date;
	}

	public String getContent() {
		return content;
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FeedItem other = (FeedItem) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public int compareTo(FeedItem o) {
		if(o == null){
			return -1;
		}
		if(date == null && o.date == null){
			return 0;
		}
		return -(this.date.compareTo(o.getDate()));
	}

}
